package com.top.art.controller;

import com.top.art.entity.AdmissionTicket;
import com.top.art.service.IAdmissionTicketService;
import com.top.art.vo.ResVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @description:
 * @author: huangyixin
 * @create: 2020/10/11 14:11
 **/
@RestController
@Slf4j
@RequestMapping(value = "/ticket")
public class AdmissionTicketController {

    @Autowired
    IAdmissionTicketService iAdmissionTicketService;

    @GetMapping(value = "/list")
    public ResVO<List<AdmissionTicket>> queryTicket(String province, String provinceCode) {
        return new ResVO<>(iAdmissionTicketService.query(province, provinceCode));
    }

    @PostMapping(value = "/create")
    public ResVO<Boolean> create(@Validated @RequestBody AdmissionTicket admissionTicket) {
        return new ResVO<>(iAdmissionTicketService.create(admissionTicket));
    }

    @PostMapping(value = "/update")
    public ResVO<Boolean> update(@Validated @RequestBody AdmissionTicket admissionTicket) {
        return new ResVO<>(iAdmissionTicketService.update(admissionTicket));
    }
}
